<template>
  <div class="patient">
    <van-nav-bar :title="$route.meta.title" />
    <!-- <van-address-list
      v-model="chosenAddressId"
      :list="patientList"
      default-tag-text="默认"
      @add="onAdd"
      @edit="onEdit"
    >
      <template #tag>
        <div></div>
      </template>
    </van-address-list> -->
    <ul>
      <li v-for="item in patientList" :key="item.Pid">
        <div class="patients">
          <div>
            <input type="checkbox" v-model="PatientId" />
          </div>
        </div>
      </li>
    </ul>
    <van-button
      type="primary"
      block
      class="addPatient"
      to="/patient/addpaitent"
    >
      <i class="iconfont icon-add"></i>
      <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;添加患者</span>
    </van-button>
  </div>
</template>
<script>
import { Toast } from 'vant'

export default {
  data () {
    return {
      chosenAddressId: '1',
      patientList: [],
      PatientId: '1'
    }
  },
  methods: {
    onAdd () {
      this.$router.push('/patient/addpaitent')
    },
    onEdit (item, index) {
      Toast('编辑:' + index)
    },
    async getPatient () {
      const res = await this.$http.GetPatientinfo()
      this.patientList = res.data
      console.log(this.patientList)
    }
  },
  created () {
    this.getPatient()
  }
}
</script>
<style lang="scss" scoped>
.patient {
  .addPatient {
    text-align: center;
    i {
      font-size: 8px;
    }
    span {
      font-size: 8px;
    }
  }
}
</style>
